import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(TestApp());
}

class TestApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  Orientation orientation;
  @override
  void initState() {
    SystemChrome.setEnabledSystemUIOverlays([]);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    orientation = MediaQuery.of(context).orientation;
    return Scaffold(
      body: orientation == Orientation.landscape
          ? GridView.count(
              crossAxisCount: 9,
              children: List.generate(99, (int index) {
                return Image.network(Platform.isIOS
                    ? 'https://raw.githubusercontent.com/Mr-Cai/Note/master/pic/img/apple.png'
                    : 'https://raw.githubusercontent.com/Mr-Cai/Note/master/pic/img/android.png');
              }),
            )
          : ListView.builder(
              physics: BouncingScrollPhysics(),
              itemCount: 99,
              itemBuilder: (BuildContext context, int index) {
                return Image.network(
                  Platform.isIOS
                      ? 'https://raw.githubusercontent.com/Mr-Cai/Note/master/pic/img/apple.png'
                      : 'https://raw.githubusercontent.com/Mr-Cai/Note/master/pic/img/android.png',
                );
              },
            ),
    );
  }
}
